<?php
/**
 * Created by PhpStorm.
 * User: birjemin
 * Date: 22/02/2018
 * Time: 4:00 PM
 */

require_once './vendor/autoload.php';

use Thrift\ClassLoader\ThriftClassLoader;
use Thrift\Protocol\TBinaryProtocol;
use Thrift\Transport\TSocket;
use Thrift\Transport\THttpClient;
use Thrift\Transport\TBufferedTransport;
use Thrift\Exception\TException;

$loader = new ThriftClassLoader();
$loader->register();


$socket = new TSocket('localhost', '9090');

$transport = new TBufferedTransport($socket, 1024, 1024);
$protocol  = new TBinaryProtocol($transport);
$client    = new \Services\HelloWorld\HelloWorldClient($protocol);
$transport->open();
echo $client->SayHello("xiaoyu123\n");
$transport->close();